﻿using StackExchange.Redis;
using System;
using System.Collections.Concurrent;

namespace Redis简单的链接
{
    public static class RedisHelp
    {
        public static string 基本链接()
        {
            ConfigurationOptions options = ConfigurationOptions.Parse("192.168.190.130:6401");
            ConnectionMultiplexer connect = ConnectionMultiplexer.Connect(options);
            IDatabase database = connect.GetDatabase(0);
            string value = database.StringGet("name");
            return value;
        }

        public static string 基本链接By带密码()
        {
            ConfigurationOptions options = ConfigurationOptions.Parse("192.168.190.130:6390");
            options.AbortOnConnectFail = false;
            options.Password = "123456";
            ConnectionMultiplexer connect = ConnectionMultiplexer.Connect(options);
            IDatabase database = connect.GetDatabase(0);
            string value = database.StringGet("name");
            return value;
        }


        public static string 基本链接By带密码第二种配置()
        {
            ConfigurationOptions options = ConfigurationOptions.Parse("192.168.190.130:6390,password=123456");
            options.AbortOnConnectFail = false;
            ConnectionMultiplexer connect = ConnectionMultiplexer.Connect(options);
            IDatabase database = connect.GetDatabase(0);
            string value = database.StringGet("name");
            return value;
        }

    }
}
